home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / btable.sty < prev    next >
Encoding:
Text File  |  1992-08-26  |  5.8 KB  |  135 lines

  1. %From: mathas_a@maths.su.oz.au ( Andrew )
  2. %Newsgroups: comp.text.tex,aus.tex
  3. %Subject: large table macros for TeX - btable.sty
  4. %Message-ID: <1990Jul6.052546.5887@metro.ucc.su.OZ.AU>
  5. %Date: 6 Jul 90 05:25:46 GMT
  6. %Sender: news@metro.ucc.su.OZ.AU (news)
  7. %Organization: Mathematics, University of Sydney
  8. %Lines: 123
  9. %Xref: jarthur comp.text.tex:1959
  10. %Replies-To: comp.text.tex
  11.  
  12. %Several people have expressed an interest in the table macros which
  13. %I purported to have. They appear below. They do *not* work in LaTeX;
  14. %however after looking at the supertab macros for LaTeX (which several
  15. %people told me about), I think that I could modifify them to work 
  16. %with LaTeX. Any one who wishes to convert them feel free as I won't
  17. %have the time to do this until the end of August.
  18.  
  19. %The basic macros were written primarily by Bob Howlett 
  20. %(howlett_r@maths.su.oz.au), with me watching and making the odd 
  21. %suggestion and modification. Consequently I have called the macros
  22. %the "btable.sty" macros. All credit should go to Bob.
  23.  
  24. %The macros were written to typeset large character tables and 
  25. %consequently everything is put into math mode. To take them out of
  26. %math mode the definitions of \tableline and \nextbit need to  be
  27. %changed in the obvious way (ie. remove the "$"s).
  28.  
  29. %The reason why I wanted these macros was that TeX and LaTeX both
  30. %spat the dummy and gave a memory overflow when I asked them to
  31. %do my tables by conventional methods. I also tried using the
  32. %tabular environment in LaTeX; butm for reasons which I can't 
  33. %comprehend (or through ill-use?), there seems to be a limit of 
  34. %approximately 15 columns in this evironment  - I needed up to
  35. %31 columns. Given this limit, the supertab environment written for LaTeX 
  36. %has the same restriction (it uses the tabular environment), and
  37. %so it would be worthwhile to convert these macros to LaTeX (they
  38. %don't work in LaTeX at the moment because \plainoutput is not 
  39. %defined in LaTeX).
  40.  
  41. %These macros do not appear to have any memory restrictions: I ran
  42. %what turned out to be 22 pages of 31 column tables through TeX in
  43. %one hit without any complaints. As such they meet my specifications -
  44. %I hope that they also met yours.
  45.                                                            
  46. %Andrew Mathas.
  47.  
  48. %  - smile at a stranger today and help make the world a better 
  49. %        place; while you're, at it, why not hug a friend!
  50.  
  51. %______________________________________________________________________
  52. %% Written by Bob Howlett with modifications by Andrew Mathas 1990.
  53. %%% Table Format:                                                
  54. %%  All entries are formatted in math mode. A horizontal line
  55. %%  is placed under the table header, and a vertical line
  56. %%  separates the first and second columns. The first column
  57. %%  is left justified and all other columns are right justified.
  58. %%  Any row can have an arbitrary number of columns. The macros were
  59. %%  designed for TeXing character tables.
  60. %%% Table Syntax:
  61. % - table begun with \starttable
  62. % - columns separated by &
  63. % - each row ended by &!
  64. % - last row of table ended by &* and followed by \endtable
  65. % - table header specified by \tableheader ...&!
  66. % - if a blank line is wanted in the table put !\gap at the 
  67. %   end of the row
  68. % - to force a page break put !\pagegap at end of row
  69. % - pages are  broken naturally if \pagegap is not used, and the
  70. %   table header is put at the top of the following page.
  71. %%% Column spacing
  72. % - nameskip:   width of the title column
  73. % - colSkip:    width of the columns                 
  74. % - colsep:     separation between columns
  75. % - firstcol:   extra space to the left of the first column (in my 
  76. %       character tables the the first column (as distinct from the
  77. %       left-most column which "labels" each row), contains the 
  78. %       degrees of the characters which are often very large numbers
  79. %       and so I needed more space: eg. psi | xxxxxxx  xxxx  xxxx ...).
  80. \def\nameskip{\kern30pt}
  81. \def\colskip{\kern20pt}       
  82. \def\colsep{\kern3pt}
  83. \def\firstcol{\kern10pt}
  84. %%% Known bug
  85. %   If the row ends with ...& &! then the next row may be
  86. %   added to the end of this row. This can be avoided 
  87. %   by typing  ...&\relax&! instead.
  88. %%  Useful note:
  89. %   set \hsize=\wd0 to make the page width equal the table width
  90.  
  91. %_________________________btable.sty____________________________________
  92. %% Written by Bob Howlett with modifications by Andrew Mathas 1990.
  93. \let\gap\relax
  94. \newif\ifpagegap
  95. \let\pagegap\pagegaptrue
  96. \def\spacing{height8.5ptdepth4.5pt}%
  97. \def\normalspacing{height8.5pt depth3.5pt}
  98. \def\moreheight{height9.5pt depth4.5pt\let\spacing\normalspacing}
  99. \def\muchmoreheight{height15pt depth4.5pt\let\spacing\normalspacing}
  100. \def\tableheader#1!{\setbox0\hbox{\def\spacing{height8.5ptdepth4.5pt}
  101.     \tableline#1*}%
  102.     \global\def\TableHeader{\copy0\hrule width\wd0\let\spacing\moreheight}}
  103. \def\starttable{\begingroup\offinterlineskip
  104.     \parskip=0pt\parindent=0pt%
  105.     \output={\plainoutput\TableHeader}
  106.     \TableHeader\startnewline}
  107. \def\startnewline{\hfil\par\futurelet\next\continue}
  108. \def\continue{\ifx\gap\next\message{III}\let\spacing\muchmoreheight\fi%
  109.    \ifx\pagegaptrue\next\vfill\eject\tableline\message{XXX}\pagegapfalse
  110.     \else\message{CCC}\tableline\fi}
  111. \def\tableline#1&{\noindent%
  112.     \rlap{$#1$}\nameskip\colsep\vrule\spacing\firstcol\nextbit}
  113. \def\nextbit#1&{\colskip\llap{$#1$}\colsep\check}
  114. \def\check#1{\if!#1\expandafter\startnewline\else\if*#1\hfil
  115.                \else\nextbit#1\relax\fi\fi}
  116. \def\endtable{\endgroup\vskip20pt}
  117. %-------------------------------------------------------------------------------
  118. \endinput 
  119. %A small example: larger examples available upon request 
  120. %(mathas_a@maths.su.oz.au).
  121. \tableheader C_1&C_2&C_3&!
  122. \starttable
  123. \chi&1&0&0&-1&!
  124. \chi&1&0&0&-1&!
  125. \chi&1&0&0&-1&!
  126. \chi&&0&0&-1&!\gap
  127. \chi&1&0&&-1&!
  128. \chi&1&0&&-1&!
  129. \chi&1&0&0&-1&!
  130. \phi&5&8&-1&2&!\pagegap
  131. \psi&1&2&&&!
  132. \alpha&59&0&*
  133. \endtable
  134. \bye                                            
  135.